package com.sys.db.daoImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sys.db.dao.DefFlowDao;
import com.sys.pojo.DefFlow;

public class DefFlowDaoImpl extends SqlMapClientDaoSupport implements DefFlowDao {

	public void delete(int id) throws Exception {
		
		this.getSqlMapClientTemplate().delete("DefFlow.delete",id);
	}

	public List findAll() throws Exception {
		List list=this.getSqlMapClientTemplate().queryForList("DefFlow.findAll");
		return list;
	}
	public List findByPage(int start,int limit) throws Exception {
		
		Map map=new HashMap<String,Integer>();
		map.put("start", start);
		map.put("end", start+limit);
		List list=this.getSqlMapClientTemplate().queryForList("DefFlow.findByPage",map);
		return list;
	}
	public DefFlow findById(int id) throws Exception {
		
		DefFlow d=(DefFlow) this.getSqlMapClientTemplate().queryForObject("DefFlow.findById",id);
		return d;
	}

	public void save(DefFlow defFlow) throws Exception {
		
		this.getSqlMapClientTemplate().insert("DefFlow.insert",defFlow);
	}

	public void update(DefFlow defFlow) throws Exception {
		
		this.getSqlMapClientTemplate().update("DefFlow.update",defFlow);
	}

	public List findByTime(String date) throws Exception {
		
		Map map=new HashMap();
		map.put("hour", date.split(":")[0]);
		map.put("minu", date.split(":")[1]);
		List list=this.getSqlMapClientTemplate().queryForList("DefFlow.findByTime",map);
		return list;
	}

	

}
